<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>JS基础——cssText的用法</title>
<style>
#div1{ width:100px; height:100px; background:#f3f3f3; border:1px solid #ccc; color:red;}
</style>
<script>
window.onload = function(){
	var	oDiv = document.getElementById('div1');
	var oBtn = document.getElementById('btn1');
	
	oDiv.onclick = function(){
    // cssText用法参考(https://www.cnblogs.com/onclick/p/4574442.html)
		oDiv.style.cssText = ' width:200px; height:200px;';	
	};
	oBtn.onclick = function(){
		//oDiv.style.width = '100px';
		oDiv.style.cssText = '';	
	};
};
</script>
</head>
 
<body>
<div id="div1" style="border-radius: 10px;background:#ffc;">123</div>
<input id="btn1" type="button" value="按钮" />
<div style="height:50vh;background-color: red;">1111111</div>
</body>
</html>